
import 'package:cunyutech_flutter_ui/src/theme/main.dart';
import 'package:flutter/widgets.dart';

/// 标题的特征
/// 1. 字号大
/// 2. 字体加粗

class CYTitle extends StatelessWidget {
  final String title;
  final TextAlign textAlign;
  final Alignment alignment;
  final EdgeInsetsGeometry margin;
  final double fontSize;
  final bool bold;
  final double lineHeight;
  final Color color;
  final double height;
  final int maxLines;

  const CYTitle(this.title, {Key key, this.maxLines, this.height, this.color, this.bold = true, this.fontSize, this.textAlign, this.alignment, this.lineHeight, this.margin }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    var cs = CYThemeData.of(context);
    return Container(
      alignment: alignment ?? Alignment.centerLeft,
      margin: margin,
      height: height,
      child: Text(
        title,
        textAlign: textAlign ?? TextAlign.left,
        maxLines: maxLines,
        style: TextStyle(
          height: lineHeight,
          fontSize: fontSize ?? CYFontSize.Large,
          fontWeight: bold == true ? FontWeight.w600 : null,
          color: color ?? cs.primaryForeColor,
        ),
      )
    );
  }
}
